package com.gitee.mango.api.enums;

import lombok.Getter;

/**
 * @description
 * @author: breeze
 * @Date: 2024-07-29
 */
@Getter
public enum StatusEnum {
    SUCCESS(0, "OK");


    private int code;

    private String msg;

    StatusEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static boolean is5xx(int code) {
        return code % 1000_000 / 1000 >= 500;
    }

    public static boolean is403(int code) {
        return code % 1000_000 / 1000 == 403;
    }

    public static boolean is4xx(int code) {
        return code % 1000_000 / 1000 < 500;
    }
}
